package com.qzsoft.zhjd.machine.modules.machinereport.controller;

import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzsoft.jeemis.common.utils.Result;
import com.qzsoft.zhjd.common.utils.ResultUtils;
import com.qzsoft.zhjd.machine.modules.machinereport.dto.DeptReportMaintenanceDto;
import com.qzsoft.zhjd.machine.modules.machinereport.dto.MachineReportMaintenanceDto;
import com.qzsoft.zhjd.machine.modules.machinereport.service.MachineReportMaintenanceService;

/**
 * @ClassName ReportMaintenanceController
 * @Description 设备保养保养统计控制器
 * @author linhuawei
 * @since 2021-11-03
 */
@RestController
@RequestMapping("/api/machineReportMaintenance")
public class MachineReportMaintenanceController {

    @Autowired
    private MachineReportMaintenanceService machineReportMaintenanceService;

    /**
     * @Title machine
     * @Description 按照机械设备进行统计
     * @param params 查询条件
     * @return 统计列表
     */
    @RequiresPermissions("api:machineReportMaintenance:list")
    @GetMapping("/machine")
    public Result<IPage<MachineReportMaintenanceDto>> machine(@RequestParam Map<String, Object> params) {
        IPage<MachineReportMaintenanceDto> page = machineReportMaintenanceService.machine(params);
        return ResultUtils.ok(page);
    }

    /**
     * @Title dept
     * @Description 按照机构进行统计
     * @param params 查询条件
     * @return 统计数据
     */
    @RequiresPermissions("api:machineReportMaintenance:list")
    @GetMapping("/dept")
    public Result<List<DeptReportMaintenanceDto>> dept(@RequestParam Map<String, Object> params) {
        List<DeptReportMaintenanceDto> dto = machineReportMaintenanceService.dept(params);
        return ResultUtils.ok(dto);
    }

}
